package com.service.imple;

import com.model.Student;
import com.mapper.StudentMapper;
import com.service.StudentService;

import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
/**
 * Created by lee on 2017/6/29.
 */
@Service
public class StudentServiceImple implements StudentService{
    @Resource
    private StudentMapper studentMapper;

    @Override
    public Boolean addStudent(Student student) {
        return studentMapper.insert(student)> 0 ? true : false;
    }
    @Override
    public Boolean deleteStudentById(Integer studentId) {
        return studentMapper.deleteByPrimaryKey(studentId)> 0 ? true : false;
    }
    @Override
    public Boolean updateStudent(Student student){
        return studentMapper.updateByPrimaryKeySelective(student)>0 ? true:false;
    }
    @Override
    public Student findStudentById(Integer studentId){
        return studentMapper.selectByPrimaryKey(studentId);
    }
    @Override
    public List<Student> findAllStudent(){
        return studentMapper.selectAll();
    }


}
